﻿@model OpenMVCRM.ViewModels.ClientViewModel

@{
    ViewBag.Title = Model.Name;
}
<fieldset>
<div class="divContainer">
<div class="divEditBar">
<div class="divBreadCrump">
      <span>You are here : </span>
      @Html.ActionLink("Clients","Index") 
      <span class="breadCrumpSeperator"></span>
     <span>@Html.ActionLink(Model.Name, "View", new { @id = Model.ID }) </span>
       <span class="breadCrumpSeperator"></span>
      <span>Delete</span>
</div>
<div class="divEditRightLinks">
    @Html.ActionLink("Edit","Edit",new {@id=Model.ID}) |
    @Html.ActionLink("Delete", "Delete", new { @id = Model.ID })
</div>
</div>

@using (Html.BeginForm())
{
<div id="divAction" class="deleteConfirm">
  <p>Are you sure to delete this Client information?</p>
  <input type="submit" name="btn" id="btn" value="Delete" />
  @Html.HiddenFor(x=>x.ID)
</div>
}
<div class="divClientInfo">
<h2>@Model.Name</h2>
<p><a href="@Model.WebSite">@Model.WebSite</a></p>
<p>
    @Model.Description
</p>

</div>

</div>
</fieldset>
<script type="text/javascript">

    $(function () {

        $("form").submit(function (e) {
            e.preventDefault();
             $("div.deleteConfirm p").text("Working on your request....");
            $.post("@Url.Action("Delete","Clients")"+"?ID="+$("#ID").val()+"&btn=del",function(data){
                if(data.Status)
                {
                  $("div.deleteConfirm p").html("Deleted Successfully").parent().removeClass("deleteConfirm").addClass("actionSuccess").find("#btn").fadeOut(100,function(){
                  
                    setTimeout(function() {
                        window.location.href = "@Url.Action("Index","Clients")";
                    }, 2500);
                  
                  });
                }
                else
                {
                    $("div.deleteConfirm p").html("Error in deleting client!").parent().removeClass("deleteConfirm").addClass("actionSuccess");;
                }
            });

        });



    });



</script>